module.exports = function (scope, template) {
  template = template
    .replace(/<%=([\s\S]+?)%>/g, '`);echo($1);echo(`')
    .replace(/<%([\s\S]+?)%>/g, '`);$1echo(`');
  template = `(() => {
    let str = '';
    const echo = (value) => {
      str += value;
    }
    echo(\`${ template }\`);
    return str;
  })()`;
  with (scope) {
    return eval(template);
  }
};
